<html>
<head>
 
</head>
<body style="text-align=center;font-size:32px;">
<table align="center">
<tr><td><div id="problemNum" style='background-color:#999999;width:800;text-align:center;font-size:32px;'></div></td></tr>
<tr><td><div id="problemContent" style='word-wrap:break-word;background-color:#bbbbbb;width:800;text-align:left;font-size:20px;'></div></td></tr>
<tr><td><div id="result" style='word-wrap:break-word; color:#ffff22;font-size:48;background-color:#8855ff;width:800;text-align:center;'></div></td></tr>
<tr><td><div id="copyleft" style='word-wrap:break-word; color:#ffff22;font-size:18;background-color:#666666;width:800;text-align:right;'></div></td></tr>
<script language="javascript">
    //---------------------------------//
    // Project Euler 
    //
    // Author:thrombin
    //   Date:2015-12-09
    //---------------------------------//  
var p_order=9;//Problem Order
 
var problem="A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,"
            +"a^2 + b^2 = c^2"
            +"For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2."
            +"There exists exactly one Pythagorean triplet for which a + b + c = 1000."
            +"Find the product abc."
 
//solve the problem
//==============编程思路简介================
//  题目a 为三者中最小，于是 a<1000/3 = 333
//      c 为三角形斜边 c<a+b, 于是 c<1000/2=500
//      b = 1000-a-c
//      
//      采用【穷举法】
//=====================================
var a=1,b=2,c=3;
var not_find=true;
 
for(a=1;(a<333 )&& not_find;a++){
    for(c=a+2;(c<500)&& not_find;c++){
        b=(1000-a-c);
        if(b>c)continue;
        if((a*a+b*b)==c*c)not_find=false;
    }
}
a--;
c--;
//update browser
document.getElementById("problemNum").innerHTML="Project Euler-Problem "+p_order;
document.getElementById("problemContent").innerHTML=problem;
document.getElementById("result").innerHTML="Answer:"+a+"*"+b+"*"+c+"="+a*b*c;
document.getElementById("copyleft").innerHTML="CopyLeft@Thrombin    2015";
</script>
</body>
</html>